﻿using Coldairarrow.Business.backstage.SearchLog;
using Coldairarrow.Entity.backstage.SearchLog;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Coldairarrow.Api.Controllers.backstage.SearchLog
{
    [Route("/frontstage/SearchLog/[controller]/[action]")]
    public class BS_SearchsWordController : BaseController
    {
        #region DI

        public BS_SearchsWordController(IBS_SearchWordBusiness bS_SearchWordBus)
        {
            _bS_SearchWordBus = bS_SearchWordBus;
        }

        IBS_SearchWordBusiness _bS_SearchWordBus { get; }

        #endregion

        #region 获取
        /// <summary>
        /// 获取热门搜索记录
        /// </summary>
        /// <param name="num"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<List<BS_SearchWord>> GetDataList(int? num)
        {
            int count = 10;
            if (num.HasValue && num > 0)
            {
                count = (int)num;
            }

            return await _bS_SearchWordBus.GetUserLogListAsync(count);
        }

        #endregion
    }
}